package com.xingguo.guide;

import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;


@Entity
@Table(name="t_guide")
public class Guide {
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Integer id;
	@Column
	private String title;
	@Column(length = 1024)
	private String content;
	@Column
	private Integer type;
	@Temporal(TemporalType.TIMESTAMP)
	private Date year;
	private String location;
	@OneToMany(targetEntity=GuideImage.class,cascade=CascadeType.ALL)
	@JoinColumn(name="guideId")
	private List<GuideImage> images;
	@Temporal(TemporalType.TIMESTAMP)
	private Date addDate;
	
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getContent() {
		return content;
	}
	public void setContent(String content) {
		this.content = content;
	}
	public Date getAddDate() {
		return addDate;
	}
	public void setAddDate(Date addDate) {
		this.addDate = addDate;
	}
	public Integer getType() {
		return type;
	}
	public void setType(Integer type) {
		this.type = type;
	}
	public List<GuideImage> getImages() {
		return images;
	}
	public void setImages(List<GuideImage> images) {
		this.images = images;
	}
	public Date getYear() {
		return year;
	}
	public void setYear(Date year) {
		this.year = year;
	}
	public String getLocation() {
		return location;
	}
	public void setLocation(String location) {
		this.location = location;
	}
	@Override
	public String toString() {
		return "Guide [id=" + id + ", title=" + title + ", content=" + content
				+ ", type=" + type + ", year=" + year + ", location="
				+ location + ", images=" + images + ", addDate=" + addDate
				+ "]";
	}
}
